﻿
"""
SAGC (dis0.0.1+OSD1.9)
Author : SNOWARE(Yu Jiangmeng)
E-mail : SALflake(at)aliyun(dot)com
Web    : 
Date   : 4-May-2024
Url    : https://gitee.com/Ironbayberry/hopeSAGC
For any suggestions, leave a comment on
https://gitee.com/Ironbayberry/hopeSAGC
It helps the teacher call his students.
Usage : python3 main-S.py(At a classroom),or python3 main-T.py(As a teacher)
Licensed under Mozila Public License (MPL) 2.0.
You are free to modify this source.
CHANGELOG
================================================
Version dis0.0.1 (May 4, 2024)
-------------------------------------------------
- First Release
"""
import socket,os
def readconfig_ip():
    fpath=os.getcwd()+"\ip.saf"
    with open(fpath,'r') as f:#  --windows用\,类unix用/！#####必须改
        return f.readline()
def sendmsg(ip,msg):
    client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    client.connect(ip, 8085)
    encoded_data = msg.encode('utf-8')  # 将字符串转换为字节
    client.sendall(encoded_data)
    client.close()
def test():
    sendmsg('127.0.0.1',"testmsg")
def close():
    sendmsg('127.0.0.1',"close!")
